<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:tr="http://www.thymeleaf.org">
<head>
    <th:block th:include="wechat/common/head::style"></th:block>
</head>
<body ontouchstart>
<div class="page">
    <div class="bd" style="height: 100%;">
        <div class="weui-tab">
            <div class="weui-tab__panel js_container"></div>
            <div class="weui-tabbar">
                <a th:each="wechatNav:${wechatNavs}" href="javascript:;" class="weui-tabbar__item" th:id="'nav-'+${wechatNav.id}">
                    <p class="weui-tabbar__label"><i th:class="${wechatNav.icon}"aria-hidden="true"></i></p>
                    <p class="weui-tabbar__label" th:text="${wechatNav.discribe}"></p>
                </a>
            </div>
        </div>
    </div>
</div>
<script type="text/html" th:each="perloadPage:${perloadPages}" th:id="'perload_page_'+${perloadPage.id}" th:data-action="@{/wechat/pageloader}+'?id
='+${perloadPage.id}" data-step="save"></script>

<th:block th:include="wechat/common/footer::scripe"></th:block>
<script th:inline="javascript">
    /*<![CDATA[*/
    $(function () {
        wx.config({
            debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: /*[[${jsapiSignature.appId}]]*/, // 必填，公众号的唯一标识
            timestamp: /*[[${jsapiSignature.timestamp}]]*/, // 必填，生成签名的时间戳
            nonceStr: /*[[${jsapiSignature.nonceStr}]]*/, // 必填，生成签名的随机串
            signature: /*[[${jsapiSignature.signature}]]*/,// 必填，签名
            jsApiList: ['scanQRCode'] // 必填，需要使用的JS接口列表
        });
        wx.ready(function(){
            $.toast("微信认证成功");// config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
        });
        wx.error(function(res){
            $.toast('微信认证失败', "forbidden");
            // config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名。
        });
    });
    /*]]>*/
</script>
<script th:inline="javascript">
    /*<![CDATA[*/
    $(function () {

        //创建并添加tabbar队列
        /*[# th:each="wechatNav: ${wechatNavs}"]*/
        var nav_/*[[${wechatNav.id}]]*/
            = {
            name: /*[['nav_'+${wechatNav.id}]]*/,
            template: /*[['#nav-'+${wechatNav.id}]]*/,
            target: /*[['child_page_'+${wechatNav.id}]]*/,
        };
        pageManager.push_nav(nav_/*[[${wechatNav.id}]]*/);
        /*[/]*/

        //创建并添加子页面队列
        /*[# th:each="perloadPage: ${perloadPages}"]*/
        var perload_page_/*[[${perloadPage.id}]]*/
            = {
            name: /*[['child_page_'+${perloadPage.id}]]*/,
            url: /*[['#child_page_'+${perloadPage.id}]]*/,
            template: /*[['#perload_page_'+${perloadPage.id}]]*/,
            /*[# th:if="${perloadPage.pid}==0"]*/
            navigation: /*[['nav_'+${perloadPage.id}]]*/,
            /*[/]*/
            events: {}
        };
        pageManager.push(perload_page_/*[[${perloadPage.id}]]*/);
        /*[/]*/
        pageManager.init();
    });
    /*]]>*/
</script>
</body>
</html>
